Search
woogc/ps/synchronize_product/ignore_meta_key - WP Global Cart
16913
documentation-template-default,single,single-documentation,postid-16913,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.0,eltd-smooth-scroll,eltd-smooth-page-transitions,eltd-mimic-ajax,eltd-grid-1200,eltd-blog-installed,eltd-default-style,eltd-fade-push-text-top,eltd-header-standard,eltd-sticky-header-on-scroll-down-up,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-menu-item-first-level-bg-color,eltd-dropdown-slide-from-top,eltd-,eltd-fullscreen-search eltd-search-fade,eltd-side-menu-slide-from-right,wpb-js-composer js-comp-ver-6.3.0,vc_responsive
 

woogc/ps/synchronize_product/ignore_meta_key

WP Global Cart / woogc/ps/synchronize_product/ignore_meta_key
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

woogc/ps/synchronize_product/ignore_meta_key

Name: woogc/ps/synchronize_product/ignore_meta_key
Type: Filter
Arguments: $IgnoreMeta, $prop_title, $prop_value, $child_product, $main_product_data, $origin_product_blog_ID

The filter can be used to ignore/skip a meta field to replicate, when running a Product synchronization procedure.

The following example ignores any parent Product Title change


    add_filter ( 'woogc/ps/synchronize_product/ignore_meta_key', 'woogc_ps_synchronize_product_ignore_meta_key', 10, 6 );
    function woogc_ps_synchronize_product_ignore_meta_key ( $ignore, $prop_title, $prop_value, $child_product, $main_product_data, $origin_product_blog_ID ) 
        {
            if ( $prop_title    ==  'name' )
                return TRUE;
               
            return $ignore;   
        }

To ignore the synchronisation for a custom field called ‘total_reviews’ the following code can be used:


    add_filter ( 'woogc/ps/synchronize_product/ignore_meta_key', 'woogc_ps_synchronize_product_ignore_meta_key', 10, 6 );
    function woogc_ps_synchronize_product_ignore_meta_key ( $ignore, $prop_title, $prop_value, $child_product, $main_product_data, $origin_product_blog_ID ) 
        {
            if ( $prop_title    ==  'total_reviews' )
                return TRUE;
               
            return $ignore;   
        }

The code should be placed inside a php file on wp-content/mu-plugins folder.

0
Would love your thoughts, please comment.x
()
x